/*****************************************************************************\
 *                            RESTRICTED RIGHTS LEGEND
 *
 *      Use, duplication, or disclosure by the Government is subject to
 *      restrictions as set forth in subparagraph (c) (1) (ii) of the Rights in
 *      Technical Data and Computer Software Clause at DFARS 252.227-7013.
 *
 *      The Board of Trustees of the University of Illinois
 *      109 Coble Hall
 *      801 South Wright Street
 *      Champaign, IL 61820-6242
 *
 *      File: StreamId.cs
 *
 *      Authors: Erich Heine, David Rodgers, Denis Kholine, Derek Dagit,
 *      William H. Sanders, Klara Nahrstedt, Rakesh Bobba, Tim Yardley
 *      Creation Date: 2012
 *
 *      Copyright (c) 2012 William H. Sanders, Klara Nahrstedt, Erich Heine,
 *      Rakesh Bobba, Tim Yardley,
 *      and The Board of Trustees of the University of Illinois
 *      All rights reserved.
 * 
 *      No further use, distribution, or disclosure beyond internal development 
 *      project participants (Grid Protection Alliance and University of Illinois)
 *      is allowed.
 *
 \*****************************************************************************/

﻿using System;

namespace SIEGate.Acl.Strawman
{
    public struct StreamId : IEquatable<StreamId>
    {
        public Guid guid
        {
            get;
            private set;
        }

        private static unsafe bool GuidEquals(Guid a, Guid b)
        {
            return ((long*)&a)[0] == ((long*)&b)[0]
                && ((long*)&a)[1] == ((long*)&b)[1];
        }

        public bool Equals(StreamId other)
        {
            return GuidEquals(this.guid, other.guid);
        }

        public StreamId(Guid id) : this()
        {
            this.guid = id;
        }
    }
}
